<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the error code from last connect call</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.maxdb-commit.html">maxdb_commit</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.maxdb-connect-error.html">maxdb_connect_error</a></div>
 <div class="up"><a href="ref.maxdb.html">MaxDB 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.maxdb-connect-errno" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">maxdb_connect_errno</h1>
  <p class="verinfo">(PECL maxdb &gt;= 1.0)</p><p class="refpurpose"><span class="refname">maxdb_connect_errno</span> &mdash; <span class="dc-title">Returns the error code from last connect call</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.maxdb-connect-errno-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><strong>maxdb_connect_errno</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   The <span class="function"><strong>maxdb_connect_errno()</strong></span> function will return the last error code number
   for last call to <span class="function"><a href="function.maxdb-connect.html" class="function">maxdb_connect()</a></span>.
   If no errors have occurred, this function will return zero.
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.maxdb-connect-errno-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   An error code value for the last call to <span class="function"><a href="function.maxdb-connect.html" class="function">maxdb_connect()</a></span>, if it failed.
   zero means no error occurred.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.maxdb-connect-errno-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-1216">
    <p><strong>Example #1 maxdb_connect_errno sample</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$link&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">maxdb_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"XXXXXXXX"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"YYYYYYYYY"</span><span style="color: #007700">);<br /><br />if&nbsp;(!</span><span style="color: #0000BB">$link</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Can't&nbsp;connect&nbsp;to&nbsp;localhost.&nbsp;Errorcode:&nbsp;%d\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">maxdb_connect_errno</span><span style="color: #007700">());<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
  <p class="para">以上例程的输出类似于：</p>
  <div class="example-contents screen">
<div class="cdata"><pre>
PHP Warning:  maxdb_connect(): -4008 POS(1) Unknown user name/password combination [08004] &lt;...&gt;
Can&#039;t connect to localhost. Errorcode: -4008
</pre></div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.maxdb-connect-errno-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.maxdb-connect.html" class="function" rel="rdfs-seeAlso">maxdb_connect()</a> - Open a new connection to the MaxDB server</span></li>
    <li class="member"><span class="function"><a href="function.maxdb-connect-error.html" class="function" rel="rdfs-seeAlso">maxdb_connect_error()</a> - Returns a string description of the last connect error</span></li>
    <li class="member"><span class="function"><a href="function.maxdb-errno.html" class="function" rel="rdfs-seeAlso">maxdb_errno()</a> - Returns the error code for the most recent function call</span></li>
    <li class="member"><span class="function"><a href="function.maxdb-error.html" class="function" rel="rdfs-seeAlso">maxdb_error()</a> - Returns a string description of the last error</span></li>
    <li class="member"><span class="function"><a href="function.maxdb-sqlstate.html" class="function" rel="rdfs-seeAlso">maxdb_sqlstate()</a> - Returns the SQLSTATE error from previous MaxDB operation</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.maxdb-commit.html">maxdb_commit</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.maxdb-connect-error.html">maxdb_connect_error</a></div>
 <div class="up"><a href="ref.maxdb.html">MaxDB 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
